import Vue from 'vue';
import App from './App.vue';

import Home from './components/Home.vue'
import Shop from './components/Shop.vue'
import Order from './components/Order.vue'
import NotFound from './components/NotFound.vue'
import TopNav from './components/TopNav.vue'
import TopBar from './components/TopBar.vue'

import VueRouter from 'vue-router';
const router = new VueRouter({
  // 路由表
  routes: [
    {
      path: '/a',
      component: Home,
      children: [
        {
          path: 'b/c/d',
          component: TopNav
        },
        {
          path: 'e/f/g',
          component: TopBar,
          children: [
            {
              path: 'x/y',
              component: Shop,
            }
          ]
        },
      ]
    },
    {
      path: '/c',
      component: Order,
    },
    {
      path: '*',
      component: NotFound,
    },
  ]
});
// 注册组件 <router-view> <router-link>
Vue.use(VueRouter);

new Vue({
  el: '#app',
  router,//路由表
  render: h => h(App),
});